package com.huayi.datagovernance;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication(scanBasePackages = "com.huayi.datagovernance")
@EnableDiscoveryClient//表示当前服务是一个 Eureka 的客户端。
@ServletComponentScan(basePackages = "com.huayi.datagovernance.servlet")
@EnableScheduling
@EnableAsync//开启异步任务
public class MpMultidbApplication implements CommandLineRunner {


//    @Autowired
//    DataSource dataSource;

    public static void main(String[] args) {
        SpringApplication.run(MpMultidbApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
/*        DynamicRoutingDataSource dataSource2 = (DynamicRoutingDataSource) dataSource;
        ItemDataSource master =(ItemDataSource) dataSource2.getDataSource("master"); //主库
        ItemDataSource slave =(ItemDataSource) dataSource2.getDataSource("slave"); //从库
        System.out.println(master.getClass());*/
    }
}
